package org.tissou.server.Services;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import org.tissou.client.Services.NouvelleCategorieService;
import org.tissou.client.Services.CategorieInfos;
import org.tissou.client.Services.MonException;
import org.tissou.server.Base.Categorie;
import org.tissou.server.Utils.InterfaceMySQL;

/**
 * Created by IntelliJ IDEA.
 * User: Claire
 * Date: 03/03/2009
 * Time: 21:12:32
 * To change this template use File | Settings | File Templates.
 */
public class NouvelleCategorieServiceImpl extends RemoteServiceServlet implements NouvelleCategorieService {
  public void CreerNouvelleCategorie(String nom, CategorieInfos parent) throws MonException {
    try{
      Categorie cat_parent = new Categorie(parent);
      cat_parent.ajouterCategorieCommeEnfant(nom, new InterfaceMySQL());
    }

    catch (MonException e) {
      throw e;
    } catch (NullPointerException e) {
      throw new MonException("NullPointerException: Desole mais ya un truc qui etait tout nul et du coup j'ai pas pu gerer.");
    }
  }
}